{% extends "default/admin/include/innerBase.html" %}{% block mainer %}
<table id="paramList" class="elementList">
	<thead><tr fold="0">
    	<th width="110px"><div>名称(编码)</div></th><th width="210px"><div>值</div></th>
    	<th width="160px"><div>描述</div></th><th width="42px"><div>加载</div></th><th><div>操作</div></th>
    </tr></thead>
{% for e in paramList %}{% include site.theme|stringformat:"s/admin/include/element.html" with e=e etype='globalParam' %}{% endfor %}
<tr id="addParam" class="treetr"><td colspan="5"><span class="addtree"><a href="javascript:addElement();">添加参数</a></span></td></tr>
</table>
<div id="addtb" style="display:none;"><form><table class="formTable">{{paramForm}}</table></form></div>
<script type="text/javascript">
<!-- 
var addDlg,editDlg;
function addElement(){
	addDlg = $.dialog({
		id:'addDlg', title:'添加参数',
		content: $('#addtb').html(),
		max: false, min: false, lock: true,
		okVal: '增加',
		init: function(){
			$('#id_value', this.DOM.content).attr('class','textarea'+$('#id_style', this.DOM.content).val());
			$('#id_style', this.DOM.content).bind('change', function(){
				$('#id_value').attr('class','textarea'+this.value);
			});
		},
	    ok: function(){
	    	var thisDlg = this;
	    	$.post('/admin/addParam!Global.do', $('form',thisDlg.DOM.content).serialize(), 
    			function(data){
	    		if(data.flag){$.dialog.alert(data.msg, function(){thisDlg.close();thisDlg.reload();});}
     				else{$.dialog.alert(data.msg);}
      			},'json');
	    	return false;
	    },
	    cancel: true
	});
}
function editElement(id){
	var url = 'url:/admin/detail!Global-'+id+'.html';
	editDlg = $.dialog({
		id:'editDlg', title:'编辑栏目',
		content: url,
		max: false, min: false, lock: true,
		okVal: '编辑', width: '300px',
		init: function(){
			if( $('#id_issys', this.iwin.document.body).val() != -1){$('#id_code', this.iwin.document.body).attr('readonly','readonly');$('#id_name', this.iwin.document.body).attr('readonly','readonly');}
			if($('#id_style', this.iwin.document.body).val() == 3){editDlg.size('500px','420px');}
			$('#id_value', this.iwin.document.body).attr('class','textarea'+$('#id_style', this.iwin.document.body).val());
			$('#id_style', this.iwin.document.body).bind('change', function(){
				$('#id_value', editDlg.iwin.document.body).attr('class','textarea'+this.value);
				if(this.value == 3){editDlg.size('500px','420px');}
				else if(this.value == 2){editDlg.size('300px','375px');}
				else{editDlg.size('300px','325px');}
			});
		},
	    ok: function(){
	    	var thisDlg = this;
	    	var forms = $('form', thisDlg.iwin.document.body).serialize()+"&_retType=json";
	    	$.post('/admin/editParam!Global.do', forms, 
    			function(data){
      				if(data.flag){$.dialog.alert(data.msg, function(){thisDlg.close();thisDlg.reload();});}
      				else{$.dialog.alert(data.msg);}
      			},'json');
	    	return false;
	    },
	    cancel: true
	});
}
$(function(){listHover();});
//-->
</script>
{% endblock %}